<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix='fmt' uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
 <base href="<%=basePath%>">
    <title>科研成果列表</title>
   
    <link rel="stylesheet" type="text/css" href="static/admin/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="static/admin/css/admin-all.css" />
    <script type="text/javascript" src="static/admin/js/jquery-1.7.2.js"></script>
    <script type="text/javascript" src="static/admin/js/jquery-ui-1.8.22.custom.min.js"></script>
    <link rel="stylesheet" type="text/css" href="Styles/ui-lightness/jquery-ui-1.8.22.custom.css" />
    <script type="text/javascript">
        $(function () {
            $('#center').hide();
            $('#bottom').hide();
            $('.top-next').click(function () {
                $('#top').hide();
                $('#center').show();
            })
            $('.center-next').click(function () {
                $('#center').hide();
                $('#bottom').show();
            })
            $('.center-prev').click(function () {
                $('#center').hide();
                $('#top').show();
            })
            $('.bottom-prev').click(function () {
                $('#bottom').hide();
                $('#center').show();
            })
        })
    </script>
    <style type="text/css">
        .auto-style1 {
            height: 26px;
        }
    </style>
            
       
        <script type="text/javascript">
     function batchDeletes(){  
               //判断至少写了一项  
               var checkedNum = $("input[name='subcheck']:checked").length;  
               if(checkedNum==0){  
                   alert("请至少选择一项!");  
                   return false;  
               }  
               if(confirm("确定删除所选项目?")){  
               var checkedList = new Array();  
               $("input[name='subcheck']:checked").each(function(){  
                   checkedList.push($(this).val());  
               });  
               $.ajax({  
                   type:"POST",  
                   url:"science/del.do",  
                   data:{"delitems":checkedList.toString()},  
                   datatype:"html",  
                   success:function(data){  
                       $("[name='checkbox2']:checkbox").attr("checked",false);  
                       location.reload();//页面刷新  
                   },  
                   error:function(data){  
                       art.dialog.tips('删除失败!');  
                   }  
               });  
               }  
       }  
</script> 
</head>
<body>
    <div class="alert alert-info">当前位置<b class="tip"></b>科研成果<b class="tip"></b>科研成果列表</div>
	<div>
	<a class="btn btn-info" href="science/goAdd.do"> <span class="glyphicon glyphicon-plus" aria-hidden="true">添加</span> </a><b></b> 
	<a class="btn btn-danger" onclick="batchDeletes()"  id="delete_all_btn" >批量删除</a>
		</div>
    <table class="table table-striped table-bordered table table-hover" id="top">
        <thead>
            <tr class="tr_detail">
               <th width="25"><input type="checkbox" id="check_all"/></th>  
                <td class="auto-style1">编号</td>
                <td class="auto-style1">标题</td>
                <td class="auto-style1">内容 </td>
                <td class="auto-style1">发布时间 </td>
                <td class="auto-style1">图片 </td>
                <td class="auto-style1">来源 </td>
				<td class="auto-style1">等级 </td>
                <td class="auto-style1">操作</td>
            </tr>
        </thead>
        <tbody>
           <c:forEach items="${pageInfo.list}" var="var">
            <tr>
           <td><input type='checkbox' class='check_item'id="subcheck" name="subcheck" value="${var.SCIENCE_ID}"/></td>  
                <td>${var.SCIENCE_ID}</td>
                <td>${var.SCIENCE_TITLE}</td>
                <td><a href="science/goContent.do?id=${var.SCIENCE_ID}">查看内容</a></td>
                <td><fmt:formatDate value="${var.PUBLISH_DATE}" pattern="yyyy-MM-dd"/></td>
				<td><a href="science/goContent.do?id=${var.SCIENCE_ID}">查看图片</a></td>
				<td>${var.SCIENCE_RESOURCE}</td>
				 <c:if test="${var.SCIENCE_LEVEL == 0}"><td>普通</td> </c:if>
				 <c:if test="${var.SCIENCE_LEVEL == 1}"><td>高级</td> </c:if>
				 <td>
				    <a class="btn btn-mini btn-success"  href="science/goEdit.do?id=${var.SCIENCE_ID}">编辑</a> 
                	<a class="btn btn-mini btn-danger" href="science/delete.do?id=${var.SCIENCE_ID}">删除</a>
                </td>
            </tr>
           
         </c:forEach> 
          
              <tr class="tr_pagenumber">
                <td colspan="100">当前第${pageInfo.pageNum }页/共${pageInfo.pages }页&nbsp;&nbsp;共${pageInfo.total }条记录&nbsp;&nbsp;
                <a class="badge badge-inverse" href="science/list.do?pn=1">首页</a>&nbsp;
                <c:if test="${pageInfo.hasPreviousPage }">
                <a class="badge badge-inverse"  href="science/list.do?pn=${pageInfo.pageNum-1 }">上一页</a>&nbsp;
                </c:if>
                    <c:forEach items="${pageInfo.navigatepageNums }" var="pageNum">
                    	<c:if test="${pageNum==pageInfo.pageNum }">
                    	  <a  class="badge badge-inverse" herf="#">${pageNum }</a>&nbsp;
                    	</c:if>
                    	<c:if test="${pageNum!=pageInfo.pageNum }">
                    	  <a  class="active"  href="science/list.do?pn=${pageNum }">${pageNum }</a>&nbsp;
                    	</c:if>
                    </c:forEach>
                    <c:if test="${pageInfo.hasNextPage }">
                   <a class="badge badge-inverse" href="science/list.do?pn=${pageInfo.pageNum+1 }">下一页</a>&nbsp;
                   </c:if>
                   <a class="badge badge-inverse"href="science/list.do?pn=${pageInfo.pages }">尾页</a>
                   </td>
            </tr>
      </tbody>
    </table>
  
</body>
 
 
 
 
</html>
